/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.unesp.demac.bcc.soo.clarus.util;

import java.text.SimpleDateFormat;

/**
 *
 * @author esaheki
 */
public class DateUtil {
    
    public static java.sql.Timestamp toSQLDate(java.util.Date utilDate) {
        return new java.sql.Timestamp(utilDate.getTime());
    }
    
    public static java.util.Date fromSQLDate(java.sql.Timestamp sqlDate) {
        return new java.util.Date(sqlDate.getTime());
    }            
    
    public static String formatDMYHms(java.util.Date date) {
        SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
        return format.format(date).toString();
    }
    
    public static String formatDMY(java.util.Date date) {
        SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
        return format.format(date).toString();
    }
}
